import type { Category } from '@/types/category'

import { request } from '@/utils/request'
export const getCategoryList = () => request<Category[]>('/category')

export const addCategory = (categoryName: string, categoryAlias: string) =>
  request('/category', 'POST', { categoryName, categoryAlias })

export const updateCategory = (
  id: number,
  categoryName: string,
  categoryAlias: string
) => request('/category', 'PUT', { id, categoryName, categoryAlias })

export const deleteCategory = (id: number) =>
  request('/category', 'DELETE', { id })
